package com.marvels.financial.task.tasklet;

import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.beans.factory.annotation.Autowired;

import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.financial.collection.api.impl.CollectionTaskApiImpl;
/**
 * 催收定时任务
 * @author zhaosa
 *
 */
public class OverDueCollectTasklet implements Tasklet {
	
	@Autowired
	private CollectionTaskApiImpl collectionTaskletApi;

	@Override
	public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
		try{
			MarvelsLogUtil.getInstance().info(">>>>>>>>>>催收定时任务出入催跑批开始");
			collectionTaskletApi.process();
			MarvelsLogUtil.getInstance().info(">>>>>>>>>>催收定时任务出入催跑批结束");
		} catch (Throwable e) {
			MarvelsLogUtil.getInstance().error(">>>>>>>>>>催收定时任务出入催跑批异常:",e);
			throw new Exception("催收定时任务出入催跑批异常",e);
		}
		return RepeatStatus.FINISHED;
	}

}
